package com.itheima.array;

/**
 * @Author 王加鑫
 * @Date 2021/4/20 15:05
 * @Version 1.0
 * 当两个int类型的数组变量同时指向一个堆内存地址的时候会发生什么呢?
 *
 */
public class arrayTest02 {
    public static void main(String[] args) {
        int[] arr1 = new int[2];
        arr1[0] = 11;
        arr1[1] = 22;
        //将arr1的内存地址复制一份给arr2
        int[] arr2 = arr1;
        arr2[0] = 33;
        arr2[1] = 44;
        System.out.println(arr2[0]);
        System.out.println(arr1[0]);
        System.out.println(arr1[1]);
        System.out.println(arr2[1]);
    }
}
